﻿using System;
using System.ServiceProcess;
using Lypshare.Net.Server;

namespace Lypshare.ServerApp
{
	/// <summary>
	/// Service.
	/// </summary>
    public partial class Service : ServiceBase
    {
        // --------------------------------------------------------
        // Class Variables
        // --------------------------------------------------------


        /// <summary>
        /// The _access point.
        /// </summary>
        private AccessPoint _accessPoint = null;


        // --------------------------------------------------------
        // Class Functions
        // --------------------------------------------------------


        /// <summary>
        /// Initializes a new instance of the <see cref="Lypshare.ServerApp.Service"/> class.
        /// </summary>
        public Service()
        {
            InitializeComponent();

        } // Constructor


        // --------------------------------------------------------
        // Class Handles
        // --------------------------------------------------------


        /// <summary>
        /// Raises the start event.
        /// </summary>
        /// <param name='args'>
        /// Arguments.
        /// </param>
        protected override void OnStart(string[] args)
        {
            _accessPoint = new AccessPoint("lypster.net", 
                9010, "LypsterAccessPoint");

            _accessPoint.Open();

        } // OnStart


        /// <summary>
        /// Raises the stop event.
        /// </summary>
        protected override void OnStop()
        {
            _accessPoint.Close();

        } // OnStop

    } // partial class Service
} // namespace Lypshare.ServerApp